package top.yokey.shopnc.model;

import top.yokey.base.base.BaseHttpClient;
import top.yokey.base.base.BaseHttpListener;

@SuppressWarnings("ALL")
public class LoginModel {

    private final String ACT = "login";
    private static volatile LoginModel instance;

    public static LoginModel get() {
        if (instance == null) {
            synchronized (LoginModel.class) {
                if (instance == null) {
                    instance = new LoginModel();
                }
            }
        }
        return instance;
    }

    public void index(String username, String password, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, Thread.currentThread().getStackTrace()[2].getMethodName())
                .add("username", username)
                .add("password", password)
                .add("client", "wap")
                .post(baseHttpListener);

    }

    public void register(String username, String password, String email, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, Thread.currentThread().getStackTrace()[2].getMethodName())
                .add("username", username)
                .add("password", password)
                .add("password_confirm", password)
                .add("email", email)
                .add("client", "wap")
                .post(baseHttpListener);

    }

}
